<?php
/**
 * 接口对接测试模块微站定义
 *
 * @author 橙橙同学
 * @url 
 */
defined('IN_IA') or exit('Access Denied');
require_once 'bm/bootstrap.php';
class Orange_apiModuleSite extends WeModuleSite {



    public function doMobileMSPark()
    {
        $api = new \app\MsParkApiTest();
        $api::queryPark('陕A12345');
        $api::payPark();

        $recordUrl = $this->createMobileUrl('ApiRecord',array('api_type'=>'mspark'));
        echo "<p style='background: #dff0d8;margin-bottom: 1px;padding: 10px;border-radius: 5px'>
            <a href='{$recordUrl}'>MSPark接口测试结束，点击查看报表</a>
        </p>";
    }


    public function doMobileMSBH()
    {
        $api = new \app\MsbhApiTest();
        $api::GetCouponList($api::dataGetCouponList());
        $api::Consumecoupon($api::dataConsumecouponCx());
        $api::Consumecoupon($api::dataConsumecouponHx());


        $recordUrl = $this->createMobileUrl('ApiRecord',array('api_type'=>'msbh'));
        echo "<p style='background: #dff0d8;margin-bottom: 1px;padding: 10px;border-radius: 5px'>

            <a href='{$recordUrl}'>MSBH接口测试结束，点击查看报表</a>

        </p>";
    }



    public function doMobileCrm()
    {
        $crmApi = new \app\CrmHttpApiTest();
        //BindCard 绑卡
        $crmApi::BindCard($crmApi::dataBindCard());
        //OpenCard 开卡
        $crmApi::OpenCard($crmApi::dataOpenCard());
        //GetVipCard 获取会员卡信息
        $crmApi::GetVipCard($crmApi::dataGetVipCard());
        //CheckVipCard 验证会员卡信息
        $crmApi::CheckVipCard($crmApi::dataCheckVipCard());
        //GetVipScore 获取会员卡积分
        $crmApi::GetVipScore($crmApi::dataGetVipScore());
        //ExchangeGift  兑换礼品扣积分
        $crmApi::ExchangeGift($crmApi::dataExchangeGift());
        //AddVipScore  活动获得会员卡积分
        $crmApi::AddVipScore($crmApi::dataAddVipScore());
        //DecVipScore  使用会员卡积分
        $crmApi::DecVipScore($crmApi::dataDecVipScore());
        //ParkDecVipScore  停车场使用会员卡积分
        $crmApi::ParkDecVipScore($crmApi::dataParkDecVipScore());
        //CheckDecVipScore  验证扣减积分是否成功
        $crmApi::CheckDecVipScore($crmApi::dataCheckVipCard());
        //CancelDecVipScore  取消扣减积分
        $crmApi::CancelDecVipScore($crmApi::dataCancelDecVipScore());
        //UpdateMemberInfo 修改会员信息
        $crmApi::UpdateMemberInfo($crmApi::dataUpdateMemberInfo());
        //GetVipCoupon 查询会员卡优惠券
        $crmApi::GetVipCoupon($crmApi::dataGetVipCoupon());
        //ExchangeScoreCoupon  兑换积分券
        $crmApi::ExchangeScoreCoupon($crmApi::dataExchangeScoreCoupon());
        //CancelbindCard 取消绑定
        $crmApi::CancelbindCard($crmApi::dataCancelbindCard());
        //SetVipPassword 设置会员卡密码
        $crmApi::SetVipPassword($crmApi::dataSetVipPassword());
        //GetVipSaleItem 获取会员消费商品明细
        $crmApi::GetVipSaleItem($crmApi::dataGetVipSaleItem());
        //GetVipScoreChangeItem 获取会员积分变动明细
        $crmApi::GetVipScoreChangeItem($crmApi::dataGetVipScoreChangeItem());
        //GetVipValidEndItem 获取到期会员卡
        $crmApi::GetVipValidEndItem($crmApi::dataGetVipValidEndItem());
        //GetVipUpgradeItem 获取可升级会员
        $crmApi::GetVipUpgradeItem($crmApi::dataGetVipUpgradeItem());

        $recordUrl = $this->createMobileUrl('ApiRecord',array('api_type'=>'crm'));
        echo "<p style='background: #dff0d8;margin-bottom: 1px;padding: 10px;border-radius: 5px'>
            <a href='{$recordUrl}'>接口测试结束，点击查看报表</a>
        </p>";

    }

    public function doMobileApiRecord()
    {
        global $_GPC;
        $api_type = $_GPC['api_type'];

        if($api_type){
            $recordList = pdo_fetchall("select * from ".tablename('api_record')."where `apitype`=:apitype",array(
                ':apitype'=>$api_type
            ));
            include $this->template('record');
        }else{
            echo "参数不能为空";
        }

    }


}